←Select platform

Find<TQuery,TResult>(DicomScp,TQuery,DicomMatchDelegate<TResult>) Method

Summary

Sends a C-FIND-REQ message to a peer member of a connection defined by Scp. The C-FIND-REQ is defined by the Query parameter.

Syntax

C#
VB
C++
public void Find<TQuery, TResult>( 
   DicomScp Scp, 
   TQuery Query, 
   DicomMatchDelegate<TResult> OnMatch 
) 
  
Public Overloads Sub Find 
    (Of TQuery,TResult)( _ 
   ByVal Scp As Leadtools.Dicom.Scu.DicomScp, _ 
   ByVal Query As TQuery, _ 
   ByVal OnMatch As Leadtools.Dicom.Scu.DicomMatchDelegate(Of TResult) _ 
)  
public: 
void Findgeneric<typename TQuery> 
generic<typename TResult> 
(  
   Leadtools.Dicom.Scu.DicomScp^ Scp, 
   _TQuery^_ Query, 
   Leadtools.Dicom.Scu.DicomMatchDelegate<TResult^>^ OnMatch 
)  

Parameters

Scp
The peer connection to send the C-FIND-REQ to.

Query
The query information that describes the DICOM datasets to be found.

OnMatch
The method to call when a dataset successfully matches the query parameters.

Type Parameters

TQuery
The type of the query.

TResult
The type of the query result.

Remarks

A DicomDataSet will be created from the Query parameter. This DicomDataSet will then be sent in the C-FIND-RQ. The Query class should be decorated with the correct attributes for creating the dataset (described in more detail below). The OnBeforeAdd delegate will be called before a tag is added to the dataset.

The Query argument determines the command and data elements of the C-FIND-RQ.

The sample class MyModalityWorklistQuery below shows examples of the attributes.

C#
 [Instance(DicomClassType.ModalityWorklist,DicomUidType.ModalityWorklistFind)] 
    public class MyModalityWorklistQuery 
    { 
        private PersonName _PatientName = new PersonName(); 
 
        [Element(DicomTag.PatientName)] 
        [TypeConverter(typeof(PersonNameConverter))] 
        public PersonName PatientName 
        { 
            get { return _PatientName; } 
            set { _PatientName = value; } 
        } 
 
        private string _PatientId = string.Empty; 
 
        [Element(DicomTag.PatientID)] 
        public string PatientId 
        { 
            get { return _PatientId; } 
            set { _PatientId = value; } 
        } 
        ... 
    } 

VB
 <Instance(DicomClassType.ModalityWorklist,DicomUidType.ModalityWorklistFind)> _ 
 Public Class MyModalityWorklistQuery 
		Private _PatientName As New PersonName() 
 
		<Element(DicomTag.PatientName), TypeConverter(GetType(PersonNameConverter))> _ 
		Public Property PatientName() As PersonName 
			Get 
				Return _PatientName 
			End Get 
			Set(ByVal value As PersonName) 
				_PatientName = value 
			End Set 
		End Property 
 
		Private _PatientId As String = String.Empty 
 
		<Element(DicomTag.PatientID)> _ 
		Public Property PatientId() As String 
			Get 
				Return _PatientId 
			End Get 
			Set(ByVal value As String) 
				_PatientId = value 
			End Set 
		End Property 
	   Private ... 
 End Class 
  

The class level Instance attribute should be included to specify a DicomUidType (the SOP Class of the DICOM find) and an associated DicomClassType that is used to create an internal DicomDataSet that specifies the data set component of the C-FIND-RQ. The elements in the internal DicomDataSet correspond to the data you wish to find.

For example, passing an instance of the MyModalityWorklistQuery class below would result in a C-FIND-RQ command set specifying:

(0000,0002) Affected SOP Class UID 1.2.840.10008.5.1.4.31 (Modality Worklist Information Model - FIND)

If the class level Instance attribute is not specified, then the Find SOP Class defaults to DicomUidType.StudyRootQueryFind

Example values for the Instance attribute pairs are shown below:

DicomUidType UID DicomClassType
DicomUidType.PatientRootQueryFind 1.2.840.10008.5.1.4.1.2.1.1 DicomClassType.PatientRootQueryPatient
DicomClassType.PatientRootQueryStudy
DicomClassType.PatientRootQuerySeries
DicomClassType.PatientRootQueryImage
DicomUidType.StudyRootQueryFind 1.2.840.10008.5.1.4.1.2.2.1 DicomClassType.StudyRootQueryStudy
DicomClassType.StudyRootQuerySeries
DicomClassType.StudyRootQueryImage
DicomUidType.ModalityWorklistFind 1.2.840.10008.5.1.4.31 DicomClassType.ModalityWorklist
DicomUidType.GeneralPurposeWorklistFind 1.2.840.10008.5.1.4.32.1 DicomClassType.GeneralPurposeWorklist
DicomUidType.HangingProtocolInformationModelFind 1.2.840.10008.5.1.4.38.2 DicomClassType.HangingProtocolInformationModelFind

An Element attribute can be included to map a class member to a DICOM element. Note that in the MyModalityWorklistQuery class, the PatientId member is decorated with an Element attribute that associates it with the DicomTag.PatientID. For example, if the PatientId member of the MyModalityWorklistQuery object contains "123", then the dataset component of the C-FIND-RQ will contain

(0010,0020) Patient ID 123

If the PatientId member of the MyModalityWorklistQuery object is empty, then no corresponding DICOM element will be added to the dataset component of the C-FIND-RQ.

Example

Finds all modality worklist items.

C#
VB
using Leadtools.Dicom.Common.DataTypes.Modality; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Scu.Queries; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Common.Extensions; 
using Leadtools.Dicom.Scu.Common; 
 
public void FindMWL() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   ModalityWorklistQuery query = new ModalityWorklistQuery(); 
   DicomScp scp = new DicomScp(); 
   QueryRetrieveScu findMwl = new QueryRetrieveScu(); 
 
   scp.AETitle = "MWL_SERVER"; 
   scp.Port = 104; 
   scp.Timeout = 60; 
   scp.PeerAddress = IPAddress.Parse("192.168.0.209"); 
   findMwl.AETitle = "LEAD_CLIENT"; 
   findMwl.Find<ModalityWorklistQuery, ModalityWorklistResult>(scp, query, FoundMatch); 
 
   DicomEngine.Shutdown(); 
   DicomNet.Startup(); 
} 
 
private void FoundMatch(ModalityWorklistResult result, DicomDataSet ds) 
{ 
   string message = 
  "\r\n\tAccession #:\t\t " + result.AccessionNumber + 
  "\r\n\tPatient Name:\t\t" + result.PatientName.Full + 
  "\r\n\tScheduled Start Date:\t" + result.ScheduledProcedureStepSequence[0].ScheduledProcedureStepStartDate.Value.ToShortDateString(); 
 
   Console.WriteLine(message); 
} 
Imports Leadtools.Dicom.Common.DataTypes.Modality 
Imports Leadtools.Dicom 
Imports Leadtools.Dicom.Scu.Queries 
Imports Leadtools.Dicom.Scu 
Imports Leadtools.Dicom.Scu.Common 
Imports Leadtools.Dicom.Common.Extensions 
 
Public Sub FindMWL() 
   DicomEngine.Startup() 
   DicomNet.Startup() 
 
   Dim query As New ModalityWorklistQuery() 
   Dim scp As New DicomScp() 
   Dim findMwl As New QueryRetrieveScu() 
 
   scp.AETitle = "MWL_SERVER" 
   scp.Port = 104 
   scp.Timeout = 60 
   scp.PeerAddress = IPAddress.Parse("192.168.0.209") 
   findMwl.AETitle = "LEAD_CLIENT" 
   findMwl.Find(Of ModalityWorklistQuery, ModalityWorklistResult)(scp, query, AddressOf FoundMatch) 
 
   DicomEngine.Shutdown() 
   DicomNet.Startup() 
End Sub 
 
Private Sub FoundMatch(ByVal result As ModalityWorklistResult, ByVal ds As DicomDataSet) 
   Dim message As String = ((vbCr & vbLf & vbTab & "Accession #:" & vbTab & vbTab & " " & result.AccessionNumber & vbCr & vbLf & vbTab _ 
                             & "Patient Name:" & vbTab & vbTab) + result.PatientName.Full & vbCr & vbLf & vbTab & "Scheduled Start Date:" & vbTab) + result.ScheduledProcedureStepSequence(0).ScheduledProcedureStepStartDate.Value.ToShortDateString() 
 
   Console.WriteLine(message) 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Scu Assembly